﻿using System.Windows;
using System.Windows.Documents;

namespace LogManager.Gui.UI.Helpers
{
    public static class FlowDocumentHelpers
    {
        public static void addTextPair(this FlowDocument doc, string item, string value)
        {
            //prefixe
            Run block_prefix = new Run(item);
            block_prefix.Foreground = System.Windows.Media.Brushes.DarkGray;
            block_prefix.FontWeight = FontWeights.Bold;
            //suffixe
            Run block_dossierDest = new Run(value);
            //ajout au paragraph
            Paragraph para = new Paragraph();
            para.Inlines.Add(block_prefix);
            para.Inlines.Add(block_dossierDest);
            para.Margin = new Thickness(0);
            //ajout au document
            doc.Blocks.Add(para);
        }

        public static void addTextTitle(this FlowDocument doc, string txt)
        {
            //prefixe
            Run block_prefix = new Run(txt);
            block_prefix.Foreground = System.Windows.Media.Brushes.Black;
            block_prefix.FontWeight = FontWeights.Bold;
            block_prefix.TextDecorations = TextDecorations.Underline;
            //ajout au paragraph
            Paragraph para = new Paragraph();
            para.Inlines.Add(block_prefix);
            para.Margin = new Thickness(0);
            //ajout au document
            doc.Blocks.Add(para);
        }
    }
}
